package es.ubu.interfaz;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.KeyEvent;

import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.border.Border;

@SuppressWarnings("serial")
public class BotonesBusqueda extends JPanel {

	private JRadioButton rb1, rb2, rb3;
	private Border b1, b2;
	private JPanel jp;
	private JButton btnBuscar;
	private JTextField txtBuscar;

	/**
	 * Create the panel.
	 */
	public BotonesBusqueda() {

		//ButtonGroup grupoDeBotones = new ButtonGroup();

		b1 = BorderFactory.createEtchedBorder();
		b2 = BorderFactory.createTitledBorder(b1, "Indica la forma de buscar");

		jp = new JPanel();
		GridBagLayout gbl_jp = new GridBagLayout();
		gbl_jp.columnWidths = new int[] { 77, 119, 122, 0 };
		gbl_jp.rowHeights = new int[] { 23, 0, 0, 0 };
		gbl_jp.columnWeights = new double[] { 0.0, 1.0, 0.0, Double.MIN_VALUE };
		gbl_jp.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
		jp.setLayout(gbl_jp);

		jp.setBorder(b2);

		rb1 = new JRadioButton("Nombre");
		rb1.setMnemonic(KeyEvent.VK_1);
		rb1.setSelected(true);

		GridBagConstraints gbc_rb1 = new GridBagConstraints();
		gbc_rb1.anchor = GridBagConstraints.NORTHWEST;
		gbc_rb1.insets = new Insets(0, 0, 5, 5);
		gbc_rb1.gridx = 0;
		gbc_rb1.gridy = 0;
		jp.add(rb1, gbc_rb1);
		// grupoDeBotones.add(rb1);

		rb2 = new JRadioButton("Cargo");
		rb2.setMnemonic(KeyEvent.VK_2);

		GridBagConstraints gbc_rb2 = new GridBagConstraints();
		gbc_rb2.anchor = GridBagConstraints.NORTHWEST;
		gbc_rb2.insets = new Insets(0, 0, 5, 5);
		gbc_rb2.gridx = 0;
		gbc_rb2.gridy = 1;
		jp.add(rb2, gbc_rb2);
		// grupoDeBotones.add(rb2);

		txtBuscar = new JTextField();
		txtBuscar.setText("Buscar");
		GridBagConstraints gbc_txtBuscar = new GridBagConstraints();
		gbc_txtBuscar.insets = new Insets(0, 0, 5, 5);
		gbc_txtBuscar.fill = GridBagConstraints.HORIZONTAL;
		gbc_txtBuscar.gridx = 1;
		gbc_txtBuscar.gridy = 1;
		jp.add(txtBuscar, gbc_txtBuscar);
		txtBuscar.setColumns(10);

		btnBuscar = new JButton("Buscar");
		GridBagConstraints gbc_btnBuscar = new GridBagConstraints();
		gbc_btnBuscar.insets = new Insets(0, 0, 5, 0);
		gbc_btnBuscar.gridx = 2;
		gbc_btnBuscar.gridy = 1;
		jp.add(btnBuscar, gbc_btnBuscar);

		rb3 = new JRadioButton("Cod.Postal");
		rb3.setMnemonic(KeyEvent.VK_3);
		rb3.setSelected(false);

		GridBagConstraints gbc_rb3 = new GridBagConstraints();
		gbc_rb3.insets = new Insets(0, 0, 0, 5);
		gbc_rb3.anchor = GridBagConstraints.NORTHWEST;
		gbc_rb3.gridx = 0;
		gbc_rb3.gridy = 2;
		jp.add(rb3, gbc_rb3);
		// grupoDeBotones.add(rb3);
	}

}
